using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MediaPortal.GUI.Rss
{
	public partial class UkNovaSetupForm : Form
	{
		public UkNovaSetupForm()
		{
			InitializeComponent();

			this.LoadSettings();
		}

		private void LoadSettings()
		{
			MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml");
			this.tbxLogin.Text = xmlreader.GetValue("torrents", "UKNova.Login") as string;
			this.tbxPassword.Text = xmlreader.GetValue("torrents", "UKNova.Password") as string;
			this.tbxUserID.Text = xmlreader.GetValue("torrents", "UKNova.UserID") as string;
		}

		private void SaveSettings()
		{
			MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("MediaPortal.xml");
			xmlwriter.SetValue("torrents", "UKNova.Login", this.tbxLogin.Text);
			xmlwriter.SetValue("torrents", "UKNova.Password", this.tbxPassword.Text);
			xmlwriter.SetValue("torrents", "UKNova.UserID", this.tbxUserID.Text);
		}

		private void bttnOK_Click(object sender, EventArgs e)
		{
			this.SaveSettings();
			this.Close();
		}

		private void bttnCancel_Click(object sender, EventArgs e)
		{
			this.Close();
		}
	}
}